<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>插件管理 - PC端</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#ffb74d',
                        secondary: '#e0e0e0',
                    }
                }
            }
        }
    </script>
    <style>
        body {
            background-color: #f8f9fa;
        }
        .card-hover:hover {
            transform: scale(1.02);
            transition: transform 0.3s ease;
        }
        .gradient-bg {
            background: linear-gradient(135deg, #ffb74d 0%, #ffa726 100%);
        }
        .sidebar-item:hover {
            background-color: rgba(255, 183, 77, 0.1);
        }
        .sidebar-item.active {
            background-color: rgba(255, 183, 77, 0.2);
            border-left: 4px solid #ffb74d;
        }
        .tab-content {
            display: none;
        }
        .tab-content.active {
            display: block;
        }
        /* 添加下拉菜单动画 */
        #userDropdown {
            transition: all 0.3s ease;
        }
        /* XML 语法高亮样式 */
        .xml-tag {
            color: #569cd6;
        }
        .xml-attr {
            color: #9cdcfe;
        }
        .xml-value {
            color: #ce9178;
        }
        .xml-comment {
            color: #6a9955;
        }
        .xml-cdata {
            color: #ce9178;
        }
        pre code {
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            line-height: 1.5;
        }
    </style>
</head>
<body class="font-sans">
    <div class="flex h-screen bg-gray-100">
        <!-- 侧边栏 -->
        <div class="w-64 bg-white shadow-md">
            <!-- 品牌标识 -->
            <div class="gradient-bg p-6">
                <h1 class="text-xl font-bold text-white">快速开发管理平台</h1>
            </div>
            
            <!-- 导航菜单 -->
            <div class="py-4">
                <div class="px-4 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider">
                    主菜单
                </div>
                
                <a href="dashboard.html" class="sidebar-item flex items-center px-6 py-3 text-gray-700">
                    <i class="fas fa-home mr-3"></i>
                    <span>控制台</span>
                </a>
                
                <a href="data-analytics-desktop.html" class="sidebar-item flex items-center px-6 py-3 text-gray-700">
                    <i class="fas fa-chart-line mr-3"></i>
                    <span>数据统计</span>
                </a>
                
                <a href="new-plugin-management.html" class="sidebar-item active flex items-center px-6 py-3 text-gray-700">
                    <i class="fas fa-puzzle-piece mr-3 text-primary"></i>
                    <span>插件管理</span>
                </a>
            </div>
        </div>
        
        <!-- 主内容区域 -->
        <div class="flex-1 overflow-y-auto">
            <!-- 顶部导航栏 -->
            <div class="bg-white shadow-sm p-4 flex justify-between items-center">
                <div>
                    <h1 class="text-xl font-bold text-gray-800">插件管理</h1>
                </div>
                
                <div class="flex items-center space-x-4">
                    <div class="relative">
                        <input type="text" placeholder="搜索插件..." class="pl-10 pr-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
                        <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
                    </div>
                    
                    <button id="uploadBtn" class="px-4 py-2 bg-gradient-to-r from-amber-400 to-orange-400 text-white rounded-lg flex items-center shadow-md hover:shadow-lg transition-all duration-300">
                        <i class="fas fa-upload mr-2"></i>
                        上传插件
                    </button>
                    
                    <!-- 用户头像下拉菜单 -->
                    <div class="relative">
                        <button id="userAvatarBtn" class="w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center hover:bg-gray-300 transition-colors">
                            <i class="fas fa-user text-gray-600"></i>
                        </button>
                        
                        <!-- 下拉菜单 -->
                        <div id="userDropdown" class="hidden absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg py-2 z-50">
                            <div class="px-4 py-2 border-b border-gray-100">
                                <p class="text-sm font-medium text-gray-700">用户名</p>
                            </div>
                            <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-50" onclick="handleLogout(event)">
                                <i class="fas fa-sign-out-alt mr-2"></i>退出登录
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 页签导航 -->
            <div class="px-6">
                <div class="border-b border-gray-200">
                    <nav class="flex -mb-px">
                        <button class="tab-btn active whitespace-nowrap py-4 px-6 border-b-2 border-primary font-medium text-primary" data-tab="all-plugins">
                            <i class="fas fa-th-large mr-2"></i>全部插件
                        </button>
                        <button class="tab-btn whitespace-nowrap py-4 px-6 border-b-2 border-transparent font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300" data-tab="active-plugins">
                            <i class="fas fa-check-circle mr-2"></i>已启用
                        </button>
                        <button class="tab-btn whitespace-nowrap py-4 px-6 border-b-2 border-transparent font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300" data-tab="inactive-plugins">
                            <i class="fas fa-times-circle mr-2"></i>已禁用
                        </button>
                    </nav>
                </div>
            </div>
            
            <!-- 页签内容区域 -->
            <div class="px-6 py-6">
                <!-- 全部插件页签 -->
                <div id="all-plugins" class="tab-content active">
                    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                        <!-- 插件卡片 1 -->
                        <div class="plugin-card bg-white rounded-xl shadow-md p-6 transition-all duration-300 card-hover" data-plugin-id="com.kld.md.modelDesigner">
                            <div class="flex justify-between items-start mb-4">
                                <div>
                                    <h2 class="text-lg font-semibold text-gray-800">ModelDesigner</h2>
                                    <p class="text-sm text-gray-500">com.kld.md.modelDesigner</p>
                                </div>
                                <span class="status-badge px-2 py-1 bg-green-100 text-green-800 text-xs rounded-full">已启用</span>
                            </div>
                            <div class="space-y-2 mb-4">
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">版本:</span>
                                    <span class="text-gray-800">1.0.2</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">兼容版本:</span>
                                    <span class="text-gray-800">231 - 243.*</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">开发者:</span>
                                    <span class="text-gray-800">moyin</span>
                                </div>
                            </div>
                            <p class="text-sm text-gray-600 mb-4 line-clamp-2">A powerful plugin for enhancing IntelliJ IDEA workflow. Supports code generation, UI automation...</p>
                            <div class="flex justify-between items-center">
                                <button class="text-amber-500 hover:text-amber-600 text-sm font-medium" onclick="showPluginDetail('com.kld.md.modelDesigner')">
                                    查看详情
                                </button>
                                <div class="flex space-x-2">
                                    <button class="toggle-status-btn text-gray-500 hover:text-gray-700 p-1" onclick="togglePluginStatus('com.kld.md.modelDesigner', false)">
                                        <i class="fas fa-ban"></i>
                                    </button>
                                    <button class="text-red-500 hover:text-red-700 p-1" onclick="deletePlugin('com.kld.md.modelDesigner')">
                                        <i class="fas fa-trash-alt"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 插件卡片 2 -->
                        <div class="plugin-card bg-white rounded-xl shadow-md p-6 transition-all duration-300 card-hover" data-plugin-id="com.example.codeformatter">
                            <div class="flex justify-between items-start mb-4">
                                <div>
                                    <h2 class="text-lg font-semibold text-gray-800">CodeFormatter</h2>
                                    <p class="text-sm text-gray-500">com.example.codeformatter</p>
                                </div>
                                <span class="status-badge px-2 py-1 bg-red-100 text-red-800 text-xs rounded-full">已禁用</span>
                            </div>
                            <div class="space-y-2 mb-4">
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">版本:</span>
                                    <span class="text-gray-800">2.1.0</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">兼容版本:</span>
                                    <span class="text-gray-800">223 - 241.*</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">开发者:</span>
                                    <span class="text-gray-800">Example Inc.</span>
                                </div>
                            </div>
                            <p class="text-sm text-gray-600 mb-4 line-clamp-2">Automatically formats your code according to predefined style guides. Supports multiple languages.</p>
                            <div class="flex justify-between items-center">
                                <button class="text-amber-500 hover:text-amber-600 text-sm font-medium" onclick="showPluginDetail('com.example.codeformatter')">
                                    查看详情
                                </button>
                                <div class="flex space-x-2">
                                    <button class="toggle-status-btn text-gray-500 hover:text-gray-700 p-1" onclick="togglePluginStatus('com.example.codeformatter', true)">
                                        <i class="fas fa-power-off"></i>
                                    </button>
                                    <button class="text-red-500 hover:text-red-700 p-1" onclick="deletePlugin('com.example.codeformatter')">
                                        <i class="fas fa-trash-alt"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 插件卡片 3 -->
                        <div class="plugin-card bg-white rounded-xl shadow-md p-6 transition-all duration-300 card-hover" data-plugin-id="org.example.gitintegration">
                            <div class="flex justify-between items-start mb-4">
                                <div>
                                    <h2 class="text-lg font-semibold text-gray-800">GitIntegration</h2>
                                    <p class="text-sm text-gray-500">org.example.gitintegration</p>
                                </div>
                                <span class="status-badge px-2 py-1 bg-green-100 text-green-800 text-xs rounded-full">已启用</span>
                            </div>
                            <div class="space-y-2 mb-4">
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">版本:</span>
                                    <span class="text-gray-800">3.4.2</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">兼容版本:</span>
                                    <span class="text-gray-800">222 - 243.*</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">开发者:</span>
                                    <span class="text-gray-800">Git Tools</span>
                                </div>
                            </div>
                            <p class="text-sm text-gray-600 mb-4 line-clamp-2">Enhanced Git integration with visual diff tools, conflict resolution, and branch management.</p>
                            <div class="flex justify-between items-center">
                                <button class="text-amber-500 hover:text-amber-600 text-sm font-medium" onclick="showPluginDetail('org.example.gitintegration')">
                                    查看详情
                                </button>
                                <div class="flex space-x-2">
                                    <button class="toggle-status-btn text-gray-500 hover:text-gray-700 p-1" onclick="togglePluginStatus('org.example.gitintegration', false)">
                                        <i class="fas fa-ban"></i>
                                    </button>
                                    <button class="text-red-500 hover:text-red-700 p-1" onclick="deletePlugin('org.example.gitintegration')">
                                        <i class="fas fa-trash-alt"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 已启用插件页签 -->
                <div id="active-plugins" class="tab-content">
                    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                        <!-- 已启用插件卡片 1 -->
                        <div class="plugin-card bg-white rounded-xl shadow-md p-6 transition-all duration-300 card-hover" data-plugin-id="com.kld.md.modelDesigner">
                            <div class="flex justify-between items-start mb-4">
                                <div>
                                    <h2 class="text-lg font-semibold text-gray-800">ModelDesigner</h2>
                                    <p class="text-sm text-gray-500">com.kld.md.modelDesigner</p>
                                </div>
                                <span class="px-2 py-1 bg-green-100 text-green-800 text-xs rounded-full">已启用</span>
                            </div>
                            <div class="space-y-2 mb-4">
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">版本:</span>
                                    <span class="text-gray-800">1.0.2</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">兼容版本:</span>
                                    <span class="text-gray-800">231 - 243.*</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">开发者:</span>
                                    <span class="text-gray-800">moyin</span>
                                </div>
                            </div>
                            <p class="text-sm text-gray-600 mb-4 line-clamp-2">A powerful plugin for enhancing IntelliJ IDEA workflow. Supports code generation, UI automation...</p>
                            <div class="flex justify-between items-center">
                                <button class="text-amber-500 hover:text-amber-600 text-sm font-medium" onclick="showPluginDetail('com.kld.md.modelDesigner')">
                                    查看详情
                                </button>
                                <div class="flex space-x-2">
                                    <button class="toggle-status-btn text-gray-500 hover:text-gray-700 p-1" onclick="togglePluginStatus('com.kld.md.modelDesigner', false)">
                                        <i class="fas fa-ban"></i>
                                    </button>
                                    <button class="text-red-500 hover:text-red-700 p-1" onclick="deletePlugin('com.kld.md.modelDesigner')">
                                        <i class="fas fa-trash-alt"></i>
                                    </button>
                                </div>
                            </div>
                        </div>

                        <!-- 已启用插件卡片 2 -->
                        <div class="plugin-card bg-white rounded-xl shadow-md p-6 transition-all duration-300 card-hover">
                            <div class="flex justify-between items-start mb-4">
                                <div>
                                    <h2 class="text-lg font-semibold text-gray-800">GitIntegration</h2>
                                    <p class="text-sm text-gray-500">org.example.gitintegration</p>
                                </div>
                                <span class="px-2 py-1 bg-green-100 text-green-800 text-xs rounded-full">已启用</span>
                            </div>
                            <div class="space-y-2 mb-4">
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">版本:</span>
                                    <span class="text-gray-800">3.4.2</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">兼容版本:</span>
                                    <span class="text-gray-800">222 - 243.*</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">开发者:</span>
                                    <span class="text-gray-800">Git Tools</span>
                                </div>
                            </div>
                            <p class="text-sm text-gray-600 mb-4 line-clamp-2">Enhanced Git integration with visual diff tools, conflict resolution, and branch management.</p>
                            <div class="flex justify-between items-center">
                                <button class="text-amber-500 hover:text-amber-600 text-sm font-medium" onclick="showPluginDetail('org.example.gitintegration')">
                                    查看详情
                                </button>
                                <div class="flex space-x-2">
                                    <button class="toggle-status-btn text-gray-500 hover:text-gray-700 p-1" onclick="togglePluginStatus('org.example.gitintegration', false)">
                                        <i class="fas fa-ban"></i>
                                    </button>
                                    <button class="text-red-500 hover:text-red-700 p-1" onclick="deletePlugin('org.example.gitintegration')">
                                        <i class="fas fa-trash-alt"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 已禁用插件页签 -->
                <div id="inactive-plugins" class="tab-content">
                    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                        <!-- 已禁用插件卡片 1 -->
                        <div class="plugin-card bg-white rounded-xl shadow-md p-6 transition-all duration-300 card-hover">
                            <div class="flex justify-between items-start mb-4">
                                <div>
                                    <h2 class="text-lg font-semibold text-gray-800">CodeFormatter</h2>
                                    <p class="text-sm text-gray-500">com.example.codeformatter</p>
                                </div>
                                <span class="px-2 py-1 bg-red-100 text-red-800 text-xs rounded-full">已禁用</span>
                            </div>
                            <div class="space-y-2 mb-4">
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">版本:</span>
                                    <span class="text-gray-800">2.1.0</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">兼容版本:</span>
                                    <span class="text-gray-800">223 - 241.*</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">开发者:</span>
                                    <span class="text-gray-800">Example Inc.</span>
                                </div>
                            </div>
                            <p class="text-sm text-gray-600 mb-4 line-clamp-2">Automatically formats your code according to predefined style guides. Supports multiple languages.</p>
                            <div class="flex justify-between items-center">
                                <button class="text-amber-500 hover:text-amber-600 text-sm font-medium" onclick="showPluginDetail('com.example.codeformatter')">
                                    查看详情
                                </button>
                                <div class="flex space-x-2">
                                    <button class="toggle-status-btn text-gray-500 hover:text-gray-700 p-1" onclick="togglePluginStatus('com.example.codeformatter', true)">
                                        <i class="fas fa-power-off"></i>
                                    </button>
                                    <button class="text-red-500 hover:text-red-700 p-1" onclick="deletePlugin('com.example.codeformatter')">
                                        <i class="fas fa-trash-alt"></i>
                                    </button>
                                </div>
                            </div>
                        </div>

                        <!-- 已禁用插件卡片 2 -->
                        <div class="plugin-card bg-white rounded-xl shadow-md p-6 transition-all duration-300 card-hover">
                            <div class="flex justify-between items-start mb-4">
                                <div>
                                    <h2 class="text-lg font-semibold text-gray-800">DatabaseTools</h2>
                                    <p class="text-sm text-gray-500">com.example.databasetools</p>
                                </div>
                                <span class="px-2 py-1 bg-red-100 text-red-800 text-xs rounded-full">已禁用</span>
                            </div>
                            <div class="space-y-2 mb-4">
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">版本:</span>
                                    <span class="text-gray-800">1.5.3</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">兼容版本:</span>
                                    <span class="text-gray-800">221 - 242.*</span>
                                </div>
                                <div class="flex items-center text-sm">
                                    <span class="text-gray-500 w-20">开发者:</span>
                                    <span class="text-gray-800">Database Team</span>
                                </div>
                            </div>
                            <p class="text-sm text-gray-600 mb-4 line-clamp-2">Comprehensive database management tools with support for multiple database types.</p>
                            <div class="flex justify-between items-center">
                                <button class="text-amber-500 hover:text-amber-600 text-sm font-medium" onclick="showPluginDetail('com.example.databasetools')">
                                    查看详情
                                </button>
                                <div class="flex space-x-2">
                                    <button class="toggle-status-btn text-gray-500 hover:text-gray-700 p-1" onclick="togglePluginStatus('com.example.databasetools', true)">
                                        <i class="fas fa-power-off"></i>
                                    </button>
                                    <button class="text-red-500 hover:text-red-700 p-1" onclick="deletePlugin('com.example.databasetools')">
                                        <i class="fas fa-trash-alt"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 分页 -->
            <div class="flex justify-center mt-6 mb-6">
                <nav class="flex items-center space-x-2">
                    <button id="prevPage" class="px-3 py-1 rounded-md text-gray-500 hover:text-gray-700 disabled:opacity-50 disabled:cursor-not-allowed" disabled>
                        <i class="fas fa-chevron-left"></i>
                    </button>
                    <div class="flex items-center space-x-1">
                        <button class="page-btn px-3 py-1 rounded-md bg-amber-100 text-amber-600 font-medium">1</button>
                        <button class="page-btn px-3 py-1 rounded-md text-gray-500 hover:text-gray-700">2</button>
                        <button class="page-btn px-3 py-1 rounded-md text-gray-500 hover:text-gray-700">3</button>
                        <span class="px-2 text-gray-500">...</span>
                        <button class="page-btn px-3 py-1 rounded-md text-gray-500 hover:text-gray-700">8</button>
                    </div>
                    <button id="nextPage" class="px-3 py-1 rounded-md text-gray-500 hover:text-gray-700">
                        <i class="fas fa-chevron-right"></i>
                    </button>
                </nav>
            </div>
        </div>
    </div>
    
    <!-- 上传插件模态框 -->
    <div id="uploadModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-xl shadow-lg w-full max-w-md p-6">
            <div class="flex justify-between items-center mb-4">
                <h2 class="text-xl font-bold text-gray-800">上传插件</h2>
                <button id="closeUploadModal" class="text-gray-500 hover:text-gray-700">
                    <i class="fas fa-times"></i>
                </button>
            </div>
            <form class="space-y-4">
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">选择插件文件</label>
                    <div class="border-2 border-dashed border-gray-300 rounded-lg p-6 text-center">
                        <input type="file" id="pluginFile" class="hidden" accept=".jar,.zip">
                        <label for="pluginFile" class="cursor-pointer">
                            <i class="fas fa-cloud-upload-alt text-4xl text-gray-400 mb-2"></i>
                            <p class="text-sm text-gray-500">点击或拖拽文件到此处上传</p>
                            <p class="text-xs text-gray-400 mt-1">支持 .jar 或 .zip 格式</p>
                        </label>
                        <div id="fileInfo" class="mt-3 hidden">
                            <div class="flex items-center justify-between bg-gray-50 p-2 rounded">
                                <div class="flex items-center">
                                    <i class="fas fa-file-archive text-amber-500 mr-2"></i>
                                    <span id="fileName" class="text-sm text-gray-700 truncate"></span>
                                </div>
                                <button type="button" id="removeFile" class="text-gray-500 hover:text-red-500">
                                    <i class="fas fa-times"></i>
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="flex justify-end space-x-3">
                    <button type="button" id="cancelUpload" class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50">
                        取消
                    </button>
                    <button type="submit" class="px-4 py-2 bg-gradient-to-r from-amber-400 to-orange-400 text-white rounded-lg shadow-md hover:shadow-lg">
                        上传
                    </button>
                </div>
            </form>
        </div>
    </div>
    
    <!-- 插件详情模态框 -->
    <div id="detailModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-xl shadow-lg w-full max-w-4xl p-6 max-h-[90vh] overflow-y-auto">
            <div class="flex justify-between items-center mb-4">
                <h2 class="text-xl font-bold text-gray-800">插件详情</h2>
                <button id="closeDetailModal" class="text-gray-500 hover:text-gray-700">
                    <i class="fas fa-times"></i>
                </button>
            </div>
            
            <div class="space-y-6">
                <!-- 基本信息 -->
                <div class="bg-gray-50 rounded-lg p-4">
                    <h3 class="text-lg font-medium text-gray-800 mb-3">基本信息</h3>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                        <div>
                            <p class="text-sm text-gray-500">插件 ID</p>
                            <p class="text-base text-gray-800 font-medium">com.kld.md.modelDesigner</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-500">插件名称</p>
                            <p class="text-base text-gray-800 font-medium">ModelDesigner</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-500">版本</p>
                            <p class="text-base text-gray-800 font-medium">1.0.2</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-500">兼容版本</p>
                            <p class="text-base text-gray-800 font-medium">231 - 243.*</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-500">开发者</p>
                            <p class="text-base text-gray-800 font-medium">moyin</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-500">联系方式</p>
                            <p class="text-base text-gray-800 font-medium">824000672@qq.com</p>
                        </div>
                    </div>
                </div>
                
                <!-- 描述信息 -->
                <div>
                    <h3 class="text-lg font-medium text-gray-800 mb-3">描述</h3>
                    <div class="bg-gray-50 rounded-lg p-4">
                        <p class="text-gray-700">A powerful plugin for enhancing IntelliJ IDEA workflow.</p>
                        <p class="text-gray-700">Supports code generation, UI automation, and integration with third-party tools.</p>
                        <p class="text-gray-700 italic">Compatible with 2023.3+ versions.</p>
                    </div>
                </div>
                
                <!-- 依赖项 -->
                <div>
                    <h3 class="text-lg font-medium text-gray-800 mb-3">依赖项</h3>
                    <div class="bg-gray-50 rounded-lg p-4">
                        <ul class="list-disc list-inside space-y-1 text-gray-700">
                            <li>com.intellij.modules.platform</li>
                            <li>com.intellij.java</li>
                            <li>org.jetbrains.idea.maven</li>
                        </ul>
                    </div>
                </div>
                
                <!-- 扩展点 -->
                <div>
                    <h3 class="text-lg font-medium text-gray-800 mb-3">扩展点</h3>
                    <div class="bg-gray-50 rounded-lg p-4">
                        <ul class="list-disc list-inside space-y-1 text-gray-700">
                            <li>moduleResourceLifeCycleListener (interface: com.kld.md.openapi.module.ModuleResourceLifeCycleListener)</li>
                            <li>projectResourceInitializationListener (interface: com.kld.md.openapi.project.ProjectResourceInitializationListener)</li>
                        </ul>
                    </div>
                </div>
                
                <!-- 插件配置文件 -->
                <div>
                    <h3 class="text-lg font-medium text-gray-800 mb-3">插件配置文件</h3>
                    <div class="bg-gray-800 rounded-lg p-4 overflow-x-auto">
                        <pre class="text-white text-sm"><code><span class="xml-comment">&lt;!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html --&gt;</span>
<span class="xml-tag">&lt;idea-plugin&gt;</span>
  <span class="xml-tag">&lt;idea-version</span> <span class="xml-attr">since-build</span>=<span class="xml-value">"231"</span> <span class="xml-attr">until-build</span>=<span class="xml-value">"243.*"</span> <span class="xml-tag">/&gt;</span>
  <span class="xml-tag">&lt;version&gt;</span>1.0.2<span class="xml-tag">&lt;/version&gt;</span>
  <span class="xml-comment">&lt;!-- Unique identifier of the plugin. It should be FQN. It cannot be changed between the plugin versions. --&gt;</span>
  <span class="xml-tag">&lt;id&gt;</span>com.kld.md.modelDesigner<span class="xml-tag">&lt;/id&gt;</span>
  <span class="xml-comment">&lt;!-- Public plugin name should be written in Title Case.
         Guidelines: https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-name --&gt;</span>
  <span class="xml-tag">&lt;name&gt;</span>ModelDesigner<span class="xml-tag">&lt;/name&gt;</span>
  <span class="xml-comment">&lt;!-- A displayed Vendor name or Organization ID displayed on the Plugins Page. --&gt;</span>
  <span class="xml-tag">&lt;vendor</span> <span class="xml-attr">email</span>=<span class="xml-value">"824000672@qq.com"</span> <span class="xml-attr">url</span>=<span class="xml-value">"824000672@qq.com"</span><span class="xml-tag">&gt;</span>moyin<span class="xml-tag">&lt;/vendor&gt;</span>
  <span class="xml-comment">&lt;!-- Description of the plugin displayed on the Plugin Page and IDE Plugin Manager.
         Simple HTML elements (text formatting, paragraphs, and lists) can be added inside of &lt;![CDATA[ ]]&gt; tag.
         Guidelines: https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-description --&gt;</span>
  <span class="xml-tag">&lt;description&gt;</span><span class="xml-cdata">&lt;![CDATA[A powerful plugin for enhancing IntelliJ IDEA workflow.
  Supports code generation, UI automation, and integration with third-party tools.
  &lt;em&gt;Compatible with 2023.3+ versions.&lt;/em&gt;]]&gt;</span><span class="xml-tag">&lt;/description&gt;</span>
  <span class="xml-comment">&lt;!-- Product and plugin compatibility requirements.
         Read more: https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html --&gt;</span>

  <span class="xml-tag">&lt;depends&gt;</span>com.intellij.modules.platform<span class="xml-tag">&lt;/depends&gt;</span>
  <span class="xml-tag">&lt;depends&gt;</span>com.intellij.java<span class="xml-tag">&lt;/depends&gt;</span>
  
  <span class="xml-comment">&lt;!-- Extension points --&gt;</span>
  <span class="xml-tag">&lt;extensionPoints&gt;</span>
    <span class="xml-tag">&lt;extensionPoint</span> <span class="xml-attr">name</span>=<span class="xml-value">"moduleResourceLifeCycleListener"</span>
      <span class="xml-attr">interface</span>=<span class="xml-value">"com.kld.md.openapi.module.ModuleResourceLifeCycleListener"</span><span class="xml-tag">/&gt;</span>
    <span class="xml-tag">&lt;extensionPoint</span> <span class="xml-attr">name</span>=<span class="xml-value">"projectResourceInitializationListener"</span>
      <span class="xml-attr">interface</span>=<span class="xml-value">"com.kld.md.openapi.project.ProjectResourceInitializationListener"</span><span class="xml-tag">/&gt;</span>
  <span class="xml-tag">&lt;/extensionPoints&gt;</span>

  <span class="xml-comment">&lt;!-- Plugin's application components --&gt;</span>
  <span class="xml-tag">&lt;application-components&gt;</span>
    <span class="xml-tag">&lt;component&gt;</span>
      <span class="xml-tag">&lt;implementation-class</span> <span class="xml-attr">/&gt;</span>
    <span class="xml-tag">&lt;/component&gt;</span>
  <span class="xml-tag">&lt;/application-components&gt;</span>

  <span class="xml-comment">&lt;!-- Plugin's project components --&gt;</span>
  <span class="xml-tag">&lt;project-components&gt;</span>
    <span class="xml-tag">&lt;component&gt;</span>
      <span class="xml-tag">&lt;implementation-class</span> <span class="xml-attr">/&gt;</span>
    <span class="xml-tag">&lt;/component&gt;</span>
  <span class="xml-tag">&lt;/project-components&gt;</span>

  <span class="xml-comment">&lt;!-- Actions --&gt;</span>
  <span class="xml-tag">&lt;actions&gt;</span>
    <span class="xml-tag">&lt;action</span> <span class="xml-attr">id</span>=<span class="xml-value">"ModelDesigner.GenerateCode"</span>
      <span class="xml-attr">class</span>=<span class="xml-value">"com.kld.md.actions.GenerateCodeAction"</span>
      <span class="xml-attr">text</span>=<span class="xml-value">"Generate Code"</span>
      <span class="xml-attr">description</span>=<span class="xml-value">"Generate template code"</span><span class="xml-tag">/&gt;</span>
  <span class="xml-tag">&lt;/actions&gt;</span>
<span class="xml-tag">&lt;/idea-plugin&gt;</span></code></pre>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <script>
        // 检查登录状态
        document.addEventListener('DOMContentLoaded', function() {
            const username = localStorage.getItem('username');
            if (username) {
                document.querySelector('#userDropdown p').textContent = username;
            }
        });

        // 处理退出登录
        function handleLogout(event) {
            event.preventDefault();
            localStorage.removeItem('username');
            localStorage.removeItem('token');
            window.location.href = 'login.html';
        }

        // 用户头像点击事件
        const userAvatarBtn = document.getElementById('userAvatarBtn');
        const userDropdown = document.getElementById('userDropdown');

        userAvatarBtn.addEventListener('click', function() {
            userDropdown.classList.toggle('hidden');
        });

        // 点击其他地方关闭下拉菜单
        document.addEventListener('click', function(event) {
            if (!userAvatarBtn.contains(event.target) && !userDropdown.contains(event.target)) {
                userDropdown.classList.add('hidden');
            }
        });

        // 切换插件状态
        function togglePluginStatus(pluginId, enable) {
            // 这里应该调用后端API来更新插件状态
            // 目前仅作演示，显示操作成功提示
            const status = enable ? '启用' : '禁用';
            
            // 模拟API调用
            setTimeout(() => {
                // 更新UI状态
                const pluginCard = document.querySelector(`[data-plugin-id="${pluginId}"]`);
                if (pluginCard) {
                    const statusBadge = pluginCard.querySelector('.status-badge');
                    const toggleButton = pluginCard.querySelector('.toggle-status-btn');
                    const toggleIcon = toggleButton.querySelector('i');
                    
                    // 更新状态标签
                    if (enable) {
                        statusBadge.classList.remove('bg-red-100', 'text-red-800');
                        statusBadge.classList.add('bg-green-100', 'text-green-800');
                        statusBadge.textContent = '已启用';
                        
                        // 更新按钮图标为禁用图标
                        toggleIcon.classList.remove('fa-power-off');
                        toggleIcon.classList.add('fa-ban');
                        toggleButton.onclick = () => togglePluginStatus(pluginId, false);
                    } else {
                        statusBadge.classList.remove('bg-green-100', 'text-green-800');
                        statusBadge.classList.add('bg-red-100', 'text-red-800');
                        statusBadge.textContent = '已禁用';
                        
                        // 更新按钮图标为启用图标
                        toggleIcon.classList.remove('fa-ban');
                        toggleIcon.classList.add('fa-power-off');
                        toggleButton.onclick = () => togglePluginStatus(pluginId, true);
                    }
                }
                
                // 显示成功提示
                showToast(`${pluginId} ${status}成功！`);
            }, 500);
        }

        // 删除插件
        function deletePlugin(pluginId) {
            if (confirm(`确定要删除插件 ${pluginId} 吗？此操作不可恢复。`)) {
                // 模拟API调用
                setTimeout(() => {
                    // 从DOM中移除插件卡片
                    const pluginCard = document.querySelector(`[data-plugin-id="${pluginId}"]`);
                    if (pluginCard) {
                        pluginCard.remove();
                    }
                    
                    // 显示成功提示
                    showToast(`插件 ${pluginId} 删除成功！`);
                }, 500);
            }
        }

        // 显示提示消息
        function showToast(message) {
            // 创建提示元素
            const toast = document.createElement('div');
            toast.className = 'fixed bottom-4 right-4 bg-gray-800 text-white px-6 py-3 rounded-lg shadow-lg z-50 transform transition-all duration-300 translate-y-0 opacity-100';
            toast.textContent = message;
            
            // 添加到页面
            document.body.appendChild(toast);
            
            // 3秒后移除
            setTimeout(() => {
                toast.style.transform = 'translateY(100%)';
                toast.style.opacity = '0';
                setTimeout(() => {
                    document.body.removeChild(toast);
                }, 300);
            }, 3000);
        }

        // 显示插件详情
        function showPluginDetail(pluginId) {
            const detailModal = document.getElementById('detailModal');
            detailModal.classList.remove('hidden');
            
            // 这里应该根据pluginId从后端获取详细信息
            // 目前仅作演示，使用静态数据
        }

        // 关闭详情模态框
        document.getElementById('closeDetailModal').addEventListener('click', function() {
            document.getElementById('detailModal').classList.add('hidden');
        });

        // 点击模态框外部关闭
        document.getElementById('detailModal').addEventListener('click', function(event) {
            if (event.target === this) {
                this.classList.add('hidden');
            }
        });

        // 页签切换功能
        const tabButtons = document.querySelectorAll('.tab-btn');
        const tabContents = document.querySelectorAll('.tab-content');

        tabButtons.forEach(button => {
            button.addEventListener('click', function() {
                // 移除所有活动状态
                tabButtons.forEach(btn => {
                    btn.classList.remove('active', 'text-primary', 'border-primary');
                    btn.classList.add('text-gray-500', 'border-transparent');
                });
                
                // 添加当前活动状态
                this.classList.remove('text-gray-500', 'border-transparent');
                this.classList.add('active', 'text-primary', 'border-primary');
                
                // 显示对应内容
                const tabId = this.getAttribute('data-tab');
                tabContents.forEach(content => {
                    content.classList.remove('active');
                    if (content.id === tabId) {
                        content.classList.add('active');
                    }
                });
            });
        });

        // 上传插件相关功能
        const uploadBtn = document.getElementById('uploadBtn');
        const uploadModal = document.getElementById('uploadModal');
        const closeUploadModal = document.getElementById('closeUploadModal');
        const cancelUpload = document.getElementById('cancelUpload');
        const pluginFile = document.getElementById('pluginFile');
        const fileInfo = document.getElementById('fileInfo');
        const fileName = document.getElementById('fileName');
        const removeFile = document.getElementById('removeFile');
        const uploadForm = uploadModal.querySelector('form');

        // 打开上传模态框
        uploadBtn.addEventListener('click', function() {
            uploadModal.classList.remove('hidden');
        });

        // 关闭上传模态框
        function closeModal() {
            uploadModal.classList.add('hidden');
            // 重置表单
            uploadForm.reset();
            fileInfo.classList.add('hidden');
        }

        closeUploadModal.addEventListener('click', closeModal);
        cancelUpload.addEventListener('click', closeModal);

        // 点击模态框外部关闭
        uploadModal.addEventListener('click', function(event) {
            if (event.target === uploadModal) {
                closeModal();
            }
        });

        // 处理文件选择
        pluginFile.addEventListener('change', function(e) {
            const file = e.target.files[0];
            if (file) {
                handleFileSelect(file);
            }
        });

        // 处理文件拖放
        const dropZone = uploadModal.querySelector('.border-dashed');
        
        dropZone.addEventListener('dragover', function(e) {
            e.preventDefault();
            this.classList.add('border-primary');
        });

        dropZone.addEventListener('dragleave', function(e) {
            e.preventDefault();
            this.classList.remove('border-primary');
        });

        dropZone.addEventListener('drop', function(e) {
            e.preventDefault();
            this.classList.remove('border-primary');
            const file = e.dataTransfer.files[0];
            if (file) {
                handleFileSelect(file);
            }
        });

        // 处理文件选择
        function handleFileSelect(file) {
            // 检查文件类型
            const validTypes = ['.jar', '.zip'];
            const fileExt = '.' + file.name.split('.').pop().toLowerCase();
            
            if (!validTypes.includes(fileExt)) {
                alert('请上传 .jar 或 .zip 格式的文件');
                return;
            }

            // 检查文件大小（限制为100MB）
            if (file.size > 100 * 1024 * 1024) {
                alert('文件大小不能超过100MB');
                return;
            }

            // 显示文件信息
            fileName.textContent = file.name;
            fileInfo.classList.remove('hidden');
        }

        // 移除文件
        removeFile.addEventListener('click', function() {
            pluginFile.value = '';
            fileInfo.classList.add('hidden');
        });

        // 处理表单提交
        uploadForm.addEventListener('submit', function(e) {
            e.preventDefault();
            
            const file = pluginFile.files[0];
            if (!file) {
                alert('请选择要上传的文件');
                return;
            }

            // 创建FormData对象
            const formData = new FormData();
            formData.append('file', file);

            // 这里应该添加实际的上传逻辑
            // 目前仅作演示，显示上传成功提示
            alert('文件上传成功！');
            closeModal();
        });

        // 分页功能
        const itemsPerPage = 6; // 每页显示的插件数量
        let currentPage = 1;
        let totalPages = 1;
        let currentTab = 'all-plugins';

        // 初始化分页
        function initializePagination() {
            const pluginCards = document.querySelectorAll(`#${currentTab} .plugin-card`);
            totalPages = Math.ceil(pluginCards.length / itemsPerPage);
            updatePaginationUI();
            showPage(currentPage);
        }

        // 更新分页UI
        function updatePaginationUI() {
            const prevBtn = document.getElementById('prevPage');
            const nextBtn = document.getElementById('nextPage');
            const pageButtons = document.querySelectorAll('.page-btn');

            // 更新上一页按钮状态
            prevBtn.disabled = currentPage === 1;

            // 更新下一页按钮状态
            nextBtn.disabled = currentPage === totalPages;

            // 更新页码按钮状态
            pageButtons.forEach((btn, index) => {
                if (index + 1 === currentPage) {
                    btn.classList.remove('text-gray-500', 'hover:text-gray-700');
                    btn.classList.add('bg-amber-100', 'text-amber-600', 'font-medium');
                } else {
                    btn.classList.remove('bg-amber-100', 'text-amber-600', 'font-medium');
                    btn.classList.add('text-gray-500', 'hover:text-gray-700');
                }
            });
        }

        // 显示指定页的插件
        function showPage(page) {
            const pluginCards = document.querySelectorAll(`#${currentTab} .plugin-card`);
            const startIndex = (page - 1) * itemsPerPage;
            const endIndex = startIndex + itemsPerPage;

            pluginCards.forEach((card, index) => {
                if (index >= startIndex && index < endIndex) {
                    card.style.display = 'block';
                } else {
                    card.style.display = 'none';
                }
            });
        }

        // 添加分页事件监听
        document.getElementById('prevPage').addEventListener('click', () => {
            if (currentPage > 1) {
                currentPage--;
                showPage(currentPage);
                updatePaginationUI();
            }
        });

        document.getElementById('nextPage').addEventListener('click', () => {
            if (currentPage < totalPages) {
                currentPage++;
                showPage(currentPage);
                updatePaginationUI();
            }
        });

        document.querySelectorAll('.page-btn').forEach((btn, index) => {
            btn.addEventListener('click', () => {
                currentPage = index + 1;
                showPage(currentPage);
                updatePaginationUI();
            });
        });

        // 修改页签切换功能，添加分页重置
        tabButtons.forEach(button => {
            button.addEventListener('click', function() {
                // 移除所有活动状态
                tabButtons.forEach(btn => {
                    btn.classList.remove('active', 'text-primary', 'border-primary');
                    btn.classList.add('text-gray-500', 'border-transparent');
                });
                
                // 添加当前活动状态
                this.classList.remove('text-gray-500', 'border-transparent');
                this.classList.add('active', 'text-primary', 'border-primary');
                
                // 显示对应内容
                const tabId = this.getAttribute('data-tab');
                tabContents.forEach(content => {
                    content.classList.remove('active');
                    if (content.id === tabId) {
                        content.classList.add('active');
                    }
                });

                // 重置分页
                currentTab = tabId;
                currentPage = 1;
                initializePagination();
            });
        });

        // 页面加载时初始化分页
        document.addEventListener('DOMContentLoaded', function() {
            initializePagination();
        });
    </script>
</body>
</html>